Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pricefeeds for rsETH and weETH on Mainnet WETH market #878

Conversation

MishaShWoof
Copy link
Contributor

No description provided.

@dmitriy-woof-software
Copy link
Contributor

To merge after conflicts resolve

@dmitriy-woof-software
Copy link
Contributor

dmitriy-woof-software commented Aug 15, 2024

Copy link
Contributor

@torreyatcitty torreyatcitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +41 to +54
constructor(address underlyingPriceFeed_, uint8 decimals_, uint8 underlyingDecimals_, string memory description_) {
underlyingPriceFeed = underlyingPriceFeed_;
if (decimals_ > 18) revert BadDecimals();
decimals = decimals_;
description = description_;

uint8 priceFeedDecimals = underlyingDecimals_;
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = priceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - priceFeedDecimals))
: signed256(10 ** (priceFeedDecimals - decimals_))
);
}

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: compound.solidity.missing-constructor-sanity-checks Warning

There're no sanity checks for the constructor argument description_.
Comment on lines +41 to +54
constructor(address underlyingPriceFeed_, uint8 decimals_, uint8 underlyingDecimals_, string memory description_) {
underlyingPriceFeed = underlyingPriceFeed_;
if (decimals_ > 18) revert BadDecimals();
decimals = decimals_;
description = description_;

uint8 priceFeedDecimals = underlyingDecimals_;
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = priceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - priceFeedDecimals))
: signed256(10 ** (priceFeedDecimals - decimals_))
);
}

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: compound.solidity.missing-constructor-sanity-checks Warning

There're no sanity checks for the constructor argument underlyingDecimals_.
Comment on lines +41 to +54
constructor(address underlyingPriceFeed_, uint8 decimals_, uint8 underlyingDecimals_, string memory description_) {
underlyingPriceFeed = underlyingPriceFeed_;
if (decimals_ > 18) revert BadDecimals();
decimals = decimals_;
description = description_;

uint8 priceFeedDecimals = underlyingDecimals_;
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = priceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - priceFeedDecimals))
: signed256(10 ** (priceFeedDecimals - decimals_))
);
}

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: compound.solidity.missing-constructor-sanity-checks Warning

There're no sanity checks for the constructor argument underlyingPriceFeed_.
Comment on lines +41 to +54
constructor(address underlyingPriceFeed_, uint8 decimals_, uint8 underlyingDecimals_, string memory description_) {
underlyingPriceFeed = underlyingPriceFeed_;
if (decimals_ > 18) revert BadDecimals();
decimals = decimals_;
description = description_;

uint8 priceFeedDecimals = underlyingDecimals_;
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = priceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - priceFeedDecimals))
: signed256(10 ** (priceFeedDecimals - decimals_))
);
}

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.non-payable-constructor Note

Consider making costructor payable to save gas.
uint256 updatedAt,
uint80 answeredInRound
) {
uint256 rate = IRateProvider(underlyingPriceFeed).getRate();

Check failure

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.security.balancer-readonly-reentrancy-getrate Error

IRateProvider(underlyingPriceFeed).getRate() call on a Balancer pool is not protected from the read-only reentrancy.
Comment on lines +41 to +54
constructor(address underlyingPriceFeed_, uint8 decimals_, string memory description_) {
underlyingPriceFeed = underlyingPriceFeed_;
if (decimals_ > 18) revert BadDecimals();
decimals = decimals_;
description = description_;

uint8 underlyingPriceFeedDecimals = 18;
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = underlyingPriceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - underlyingPriceFeedDecimals))
: signed256(10 ** (underlyingPriceFeedDecimals - decimals_))
);
}

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: compound.solidity.missing-constructor-sanity-checks Warning

There're no sanity checks for the constructor argument description_.
Comment on lines +41 to +54
constructor(address underlyingPriceFeed_, uint8 decimals_, string memory description_) {
underlyingPriceFeed = underlyingPriceFeed_;
if (decimals_ > 18) revert BadDecimals();
decimals = decimals_;
description = description_;

uint8 underlyingPriceFeedDecimals = 18;
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = underlyingPriceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - underlyingPriceFeedDecimals))
: signed256(10 ** (underlyingPriceFeedDecimals - decimals_))
);
}

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: compound.solidity.missing-constructor-sanity-checks Warning

There're no sanity checks for the constructor argument underlyingPriceFeed_.
Comment on lines +41 to +54
constructor(address underlyingPriceFeed_, uint8 decimals_, string memory description_) {
underlyingPriceFeed = underlyingPriceFeed_;
if (decimals_ > 18) revert BadDecimals();
decimals = decimals_;
description = description_;

uint8 underlyingPriceFeedDecimals = 18;
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = underlyingPriceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - underlyingPriceFeedDecimals))
: signed256(10 ** (underlyingPriceFeedDecimals - decimals_))
);
}

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.non-payable-constructor Note

Consider making costructor payable to save gas.
@torreyatcitty torreyatcitty merged commit b1ea9b0 into compound-finance:main Aug 16, 2024
2 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants